//import 'package:ly/provied/cartmodel.dart';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import '../provied/cartmodel.dart';
class Drawerpage extends StatefulWidget {
  Drawerpage({Key key}) : super(key: key);

  @override
  _DrawerpageState createState() => _DrawerpageState();
}

class _DrawerpageState extends State<Drawerpage> {
  void _getcleartoken()async{

  }
  //http://dbyxs.xyz:3005/uploads/b593883c3adac89564d762ae7b76ad5e
  @override
  Widget build(BuildContext context) {
    return ListView(
      children: <Widget>[
        UserAccountsDrawerHeader(accountName: context.watch<CartProvide>().flname==false?Text('小仙女'):Text('${ context.watch<CartProvide>().user}'), accountEmail: Text('邮箱地址'),currentAccountPicture: CircleAvatar(
         backgroundImage: NetworkImage(context.watch<CartProvide>().userimages==null?'http://dbyxs.xyz:3005/uploads/fae4e814a5d9510d10277ff78ea6dc12':'${context.watch<CartProvide>().userimages}',),),
         decoration: BoxDecoration(
           color: Colors.blue[500],
           image: DecorationImage(image: NetworkImage(context.watch<CartProvide>().userimages==null?'http://dbyxs.xyz:3005/uploads/fae4e814a5d9510d10277ff78ea6dc12':'${context.watch<CartProvide>().userimages}',),fit:BoxFit.cover,
           colorFilter: ColorFilter.mode(Colors.pink[50].withOpacity(0.6), BlendMode.hardLight)
           )
         ),
         ),
         ListTile(
           title: Text('设置',style: TextStyle(color:Colors.black54),),
           trailing: Icon(Icons.settings),
           onTap: (){
             print('设置');
           },
         ),
           new Divider(),
           ListTile(
           title: Text('购物车',style: TextStyle(color:Colors.black54)),
           trailing: Icon(Icons.shopping_cart),
           onTap: (){
             Navigator.pushNamed(context, '/cart');
             print('设置');
           },
         ),
         new Divider(),
           ListTile(
           title: Text('注销/登录',style: TextStyle(color:Colors.black54)),
           trailing: Icon(Icons.power_settings_new),
           onTap: (){
             context.read<CartProvide>().getclearToken();
            // Navigator.pushNamed(context, '/cart');
             print('设置');
           },
         ),
      ],
    );
  }
}